<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/css_js.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Editor Grid Example</title>
<link id="screenBaseCss" rel="stylesheet" type="text/css" href="<s:url value="/css/screen.css"/>"/>
<script src="<s:url value="/js/ejs/Grid/GridE.js"/>" type="text/javascript"> </script>
<link href="<s:url value="/js/ejs/Styles/vtc.css"/>" rel="stylesheet" type="text/css" />
<style>
a {
	color:black;
	text-decoration:none;
}
a:hover {
	color:black;
	text-decoration:underline;
}
</style>


<script type="text/javascript">

var type = "<s:property value='categoryNodeType'/>";

function childOnClick(nodeId, isLeaf){
	
	if(confirm('Confirm to move ?')){
		
		$.ajax({
			url : "categoryBranch!changeParent.action?no-decorate=0&categoryNodeId=<s:property value='categoryNodeId'/>&parentId="+nodeId+"&categoryId=<s:property value='categoryId'/>"
					,
			cache : true,
			dataType : "text",
			async : false,
			success : function(data) {
				if(data=="success"){
					window.top.catTree.location = "category!loadCategoryTree.action?no-decorate=0&categoryId=<s:property value='categoryId'/>";
					if(type == "Leaf"){
						window.top.catForm.location = "categoryLeaf!list.action?no-decorate=0&categoryNodeId=<s:property value='categoryNodeId'/>&categoryId=<s:property value='categoryId'/>";	
					}else{
						window.top.catForm.location = "categoryBranch!list.action?no-decorate=0&categoryNodeId=<s:property value='categoryNodeId'/>&categoryId=<s:property value='categoryId'/>";	
					}
					CE.close();
				}else{
					document.getElementById("errorMessage").innerHTML=data;
				}
			},
			error : function(data) {
				document.getElementById("errorMessage").innerHTML=data;
			}
		});
		
	}
	
}
</script>
</head>
<body>
<div class="body" style="height:100%;" >
<label  id="errorMessage" style="color: red;"></label>
  <div style="width:100%;height:90%;">
    <treegrid Data_Url="category!getTreeGridData.action?no-decorate=0&categoryId=<s:property value='categoryId'/>"> </treegrid>
  </div>
</div>
</body>
</html>
